40e1c0660b3df7156f32102565248a05ae86439a,stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/datastax/impl/DataStaxClusterImpl.java,DataStaxClusterImpl,createApplicationLocalKeyspace,#,141

Before Change


    @Override
    public synchronized void createApplicationLocalKeyspace() throws Exception {

        boolean exists = getClusterSession().getCluster().getMetadata()
            .getKeyspace(CQLUtils.quote( cassandraConfig.getApplicationLocalKeyspace())) != null;

        if (exists) {
            logger.info("Not creating keyspace {}, it already exists.", cassandraConfig.getApplicationLocalKeyspace());

After Change


        //boolean exists = getClusterSession().getCluster().getMetadata()
        //    .getKeyspace(CQLUtils.quote( cassandraConfig.getApplicationLocalKeyspace())) != null;

        Row row = getClusterSession()
            .execute("select * from system.schema_keyspaces where keyspace_name = '"+cassandraConfig.getApplicationLocalKeyspace()+"'")
            .one();

        if (row != null) {
            logger.info("Not creating keyspace {}, it already exists.", cassandraConfig.getApplicationLocalKeyspace());